package com.woniu.defecttracking.exception;


import com.woniu.defecttracking.commens.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class DefectTrackingExceptionHandler {



    //父异常
    @ExceptionHandler(DefectTrackingException.class)
    public Result DefectTrackingException(DefectTrackingException e){
        return Result.getInstance(null).setMessage(e.getMessage()).setCode(e.getCode());
    }
    @ExceptionHandler(Exception.class)
    public Result Exception(Exception e){
        e.printStackTrace();
        return Result.getInstance(null).setMessage("有异常").setCode(500);
    }
}
